// src/entity/SensorHourlyData.ts
import { Entity, PrimaryColumn, Column, Index } from 'typeorm';

@Entity({ name: 'sensor_hourly_data' })
@Index('idx_sensor_hourly_time', ['hourStart'])
export class SensorHourlyData {
  @PrimaryColumn()
  deviceId!: string;

  @PrimaryColumn()
  metricType!: string; // 'temperature', 'humidity', 'pm25'

  @PrimaryColumn({ type: 'timestamp' })
  hourStart!: Date;

  @Column('float') // 或 'decimal', 取决于你数据库配置
  metricValue!: number;
}
